<?php
/**
 * @var $ticket Ticket
 */
?>
<table class="full">
	<tbody>
	<tr>
		<th>Id:</th>
		<td><?php echo $ticket->getId() ?></td>
	</tr>
	<tr>
		<th>Created by:</th>
		<?php if ($ticket->getCreatedBy()->getEmailAddress()) : ?>
			<td><a href="mailto:<?php echo $ticket->getCreatedBy()->getEmailAddress() ?>"><?php echo $ticket->getCreatedBy() ?></a></td>
		<?php else : ?>
			<td><?php echo $ticket->getCreatedBy() ?></td>
		<?php endif; ?>
	</tr>
	<tr>
		<th>Assigned to:</th>
		<?php if ($ticket->getAssignedTo()->getEmailAddress()) : ?>
			<td><a href="mailto:<?php echo $ticket->getAssignedTo()->getEmailAddress() ?>"><?php echo $ticket->getAssignedTo() ?></a></td>
		<?php else : ?>
			<td><?php echo $ticket->getAssignedTo() ?></td>
		<?php endif; ?>
	</tr>
	<tr>
		<th>Title:</th>
		<td><?php echo $ticket->getTitle() ?></td>
	</tr>
	<tr>
		<th>Description:</th>
		<td><?php echo $ticket->getDescription() ?></td>
	</tr>
	<tr>
		<th>Progress:</th>
		<td><?php echo $ticket->getProgress() ?></td>
	</tr>
	<tr>
		<th>Ticket priority:</th>
		<td><?php echo $ticket->getTicketPriorityId() ?></td>
	</tr>
	<tr>
		<th>Created at:</th>
		<td><?php echo $ticket->getCreatedAt() ?></td>
	</tr>
	<tr>
		<th>Updated at:</th>
		<td><?php echo $ticket->getUpdatedAt() ?></td>
	</tr>
	<tr>
		<th>Hardwares:</th>
		<td>
			<table>
				<tr>
					<th>Identifier</th>
					<th>Room</th>
				</tr>
			<?php foreach($ticket->getHardwares() as $hardware): ?>
				<tr>
					<td><?php echo $hardware->getUid(); ?></td>
					<td><?php echo $hardware->getRoom(); ?></td>
				</tr>
			<?php endforeach; ?>
			</table>
		</td>
	</tr>
	<?php if(method_exists($ticket, "getFiles")) : ?>
	<tr>
		<th>Files:</th>
		<td>
			<table>
				<tr>
					<th>Path</th>
					<th>User</th>
				</tr>
			<?php foreach($ticket->getFiles() as $file): ?>
				<tr>
					<td><?php echo $file->getPath(); ?></td>
					<td><?php echo $file->getUser(); ?></td>
				</tr>
			<?php endforeach; ?>
			</table>
		</td>
	</tr>
	<?php endif; ?>
	<?php if(method_exists($ticket, "getTicketNotes")) : ?>
	<tr>
		<th>Files:</th>
		<td>
			<table>
				<tr>
					<th>gebrauchte Zeit</th>
					<th>Text</th>
				</tr>
			<?php foreach($ticket->getTicketNotes() as $ticketNote): /** @var TicketNote $ticketNote */ ?>
				<tr>
					<td><?php echo $ticketNote->getSpentTime(); ?></td>
					<td><?php echo $ticketNote->getText(); ?></td>
				</tr>
			<?php endforeach; ?>
			</table>
		</td>
	</tr>
	<?php endif; ?>
	</tbody>
</table>

<hr />

<a href="<?php echo url_for('ticketNote/new?ticket=' . $ticket->getId()) ?>">Create new note</a>
&nbsp;
<a href="<?php echo url_for('ticket/edit?id=' . $ticket->getId()) ?>">Edit</a>
&nbsp;
<a href="<?php echo url_for('ticket/index') ?>">List</a>
